
from ollama import chat

def get_weather(location: str) -> str:
    return f"{location}天气晴朗，温度25℃。"

response = chat(
    model='llama3.2',
    messages=[{'role': 'user', 'content': '上海天气如何？'}],
    tools=[get_weather]
)
print(response.message.content)
print(response)

